ASSERT ( bios_image_base < 0x100000 );
- if ( lowmem_reserved_base < ACPI_INFO_PHYSICAL_ADDRESS ) {
+ if ( lowmem_reserved_base < ACPI_INFO_PHYSICAL_ADDRESS )
+ {
/*
* 0x0-lowmem_reserved_base: Ordinary RAM.
*/
perform_tests();
- if (bios->bios_info_setup)
+ if ( bios->bios_info_setup )
bios->bios_info_setup();
- if (bios->create_smbios_tables) {
+ if ( bios->create_smbios_tables )
+ {
printf("Writing SMBIOS tables ...\n");
bios->create_smbios_tables();
}
- if (bios->bios_load) {
+ printf("Loading %s ...\n", bios->name);
+ if ( bios->bios_load )
bios->bios_load(bios);
- } else {
- printf("Loading %s ...\n", bios->name);
+ else
memcpy((void *)bios->bios_address, bios->image,
bios->image_size);
- }
- if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode ) {
+ if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
+ {
if ( bios->create_mp_tables )
bios->create_mp_tables();
if ( bios->create_pir_tables )
.value = 1,
};
- if ( bios->acpi_build_tables ) {
+ if ( bios->acpi_build_tables )
+ {
printf("Loading ACPI ...\n");
bios->acpi_build_tables();
}
+
hypercall_hvm_op(HVMOP_set_param, &p);
}
- if (bios->vm86_setup)
+ if ( bios->vm86_setup )
bios->vm86_setup();
cmos_write_memory_size();
bios->bios_address,
bios->bios_address + bios->image_size - 1);
- if (bios->e820_setup)
+ if ( bios->e820_setup )
bios->e820_setup();
- if (bios->bios_info_finish)
+ if ( bios->bios_info_finish )
bios->bios_info_finish();
xenbus_shutdown();
/* fills in an MP bus entry of type 'type' and bus ID 'bus_id' */
-static void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
+static void fill_mp_bus_entry(
+ struct mp_bus_entry *mpbe, int bus_id, const char *type)
{
int i;
printf("Creating MP tables ...\n");
- if (!_mpfps) {
+ if ( _mpfps == NULL )
+ {
int sz;
sz = sizeof(struct mp_floating_pointer_struct);
sz += sizeof(struct mp_ioapic_entry);
sz += sizeof(struct mp_io_intr_entry) * 16;
- base = mem_alloc(sz, 0);
+ _mpfps = mem_alloc(sz, 0);
}
mpfps = _mpfps;
*/
unsigned long create_pir_tables(void)
{
- int length = sizeof(struct pir_table) + sizeof(struct pir_slot)*NR_PIR_SLOTS;
+ int length = sizeof(struct pir_table)
+ + sizeof(struct pir_slot) * NR_PIR_SLOTS;
struct pir_table *pir = scratch_alloc(length, 0);
int i, checksum;
}
checksum = 0;
- for ( i = 0; i < length; i++)
- {
+ for ( i = 0; i < length; i++ )
checksum += ((int8_t *)pir)[i];
- }
pir->checksum = -checksum;
return (unsigned long)pir;
uint32_t bioshigh;
struct rombios_info *info;
- printf("Loading %s ...\n", config->name);
memcpy((void *)config->bios_address, config->image,
config->image_size);
bios_mem != (char *)ROMBIOS_END;
bios_mem++ )
{
- if ( strncmp(bios_mem, "___HVMMP", 8) == 0)
+ if ( strncmp(bios_mem, "___HVMMP", 8) == 0 )
return bios_mem;
}
uint8_t checksum;
checksum = 0;
- for (i = 0; i < ROMBIOS_MAXOFFSET; ++i)
+ for ( i = 0; i < ROMBIOS_MAXOFFSET; i++ )
checksum += ((uint8_t *)(ROMBIOS_BEGIN))[i];
*((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
static void rombios_create_smbios_tables(void)
{
- hvm_write_smbios_tables(SMBIOS_PHYSICAL_ADDRESS,
- SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
- SMBIOS_PHYSICAL_END);
+ hvm_write_smbios_tables(
+ SMBIOS_PHYSICAL_ADDRESS,
+ SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
+ SMBIOS_PHYSICAL_END);
}
//BUILD_BUG_ON(sizeof(rombios) > (0x00100000U - ROMBIOS_PHYSICAL_ADDRESS));
uint8_t checksum;
checksum = 0;
- for (i = 0; i < info->length; ++i)
+ for ( i = 0; i < info->length; i++ )
checksum += ((uint8_t *)(info))[i];
info->checksum = -checksum;
cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8],
(uint32_t *)&id[4]);
- if (memcmp(id, "GenuineIntel", 12) == 0)
+ if ( memcmp(id, "GenuineIntel", 12) == 0 )
strncpy(buf, "Intel", len);
- else if (memcmp(id, "AuthenticAMD", 12) == 0)
+ else if ( memcmp(id, "AuthenticAMD", 12) == 0 )
strncpy(buf, "AMD", len);
else
strncpy(buf, "unknown", len);
}
void
-hvm_write_smbios_tables(unsigned long ep, unsigned long smbios_start, unsigned long smbios_end)
+hvm_write_smbios_tables(
+ unsigned long ep, unsigned long smbios_start, unsigned long smbios_end)
{
xen_domain_handle_t uuid;
uint16_t xen_major_version, xen_minor_version;
memcpy((void *)smbios_start, (void *)scratch_start, len);
- smbios_entry_point_init((void *)ep, max_struct_size, len, smbios_start, nr_structs);
+ smbios_entry_point_init(
+ (void *)ep, max_struct_size, len, smbios_start, nr_structs);
return;
p->embedded_controller_minor = 0xff;
start += sizeof(struct smbios_type_0);
- if ((s = xenstore_read("bios-strings/bios-vendor")) == NULL || *s == '\0')
+ if ( ((s = xenstore_read("bios-strings/bios-vendor")) == NULL)
+ || (*s == '\0') )
s = "Xen";
strcpy((char *)start, s);
start += strlen(s) + 1;
- if ((s = xenstore_read("bios-strings/bios-version")) == NULL || *s == '\0')
+ if ( ((s = xenstore_read("bios-strings/bios-version")) == NULL)
+ || (*s == '\0') )
s = xen_version;
strcpy((char *)start, s);
start += strlen(s) + 1;
start += sizeof(struct smbios_type_1);
- if ((s = xenstore_read("bios-strings/system-manufacturer")) == NULL
- || *s == '\0')
+ if ( ((s = xenstore_read("bios-strings/system-manufacturer")) == NULL)
+ || (*s == '\0') )
s = "Xen";
strcpy((char *)start, s);
start += strlen(s) + 1;
- if ((s = xenstore_read("bios-strings/system-product-name")) == NULL
- || *s == '\0')
+ if ( ((s = xenstore_read("bios-strings/system-product-name")) == NULL)
+ || (*s == '\0') )
s = "HVM domU";
strcpy((char *)start, s);
start += strlen(s) + 1;
- if ((s = xenstore_read("bios-strings/system-version")) == NULL
- || *s == '\0')
+ if ( ((s = xenstore_read("bios-strings/system-version")) == NULL)
+ || (*s == '\0') )
s = xen_version;
strcpy((char *)start, s);
start += strlen(s) + 1;
uuid_to_string(uuid_str, uuid);
- if ((s = xenstore_read("bios-strings/system-serial-number")) == NULL
- || *s == '\0')
+ if ( ((s = xenstore_read("bios-strings/system-serial-number")) == NULL)
+ || (*s == '\0') )
s = uuid_str;
strcpy((char *)start, s);
start += strlen(s) + 1;
start += sizeof(struct smbios_type_11);
/* Pull out as many oem-* strings we find in xenstore */
- for (i = 1; i < 100; i++) {
+ for ( i = 1; i < 100; i++ )
+ {
path[(sizeof path) - 3] = '0' + ((i < 10) ? i : i / 10);
path[(sizeof path) - 2] = (i < 10) ? '\0' : '0' + (i % 10);
- if ((s = xenstore_read(path)) == NULL || *s == '\0')
+ if ( ((s = xenstore_read(path)) == NULL) || (*s == '\0') )
break;
strcpy((char *)start, s);
start += strlen(s) + 1;
}
/* Make sure there's at least one type-11 string */
- if (p->count == 0) {
+ if ( p->count == 0 )
+ {
strcpy((char *)start, "Xen");
start += strlen("Xen") + 1;
p->count++;
/* Miscellaneous. */
void cacheattr_init(void);
unsigned long create_mp_tables(void *table);
-void hvm_write_smbios_tables(unsigned long ep,
- unsigned long smbios_start,
- unsigned long smbios_end);
+void hvm_write_smbios_tables(
+ unsigned long ep, unsigned long smbios_start, unsigned long smbios_end);
unsigned long create_pir_tables(void);
void smp_initialise(void);